package com.panda.web.controller.commons;

import com.panda.common.core.domain.R;
import com.panda.web.domain.dto.TrendDTO;
import com.panda.web.domain.vo.commons.BackGroundVO;
import com.panda.web.service.commons.BackgroundService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@CrossOrigin
@RestController
@RequestMapping("/background")
public class BackgroundController {

    @Autowired
    BackgroundService backgroundService;

    /**
     * 首页数据
     *
     * @return
     */
    @GetMapping("/homepage")
    public R getHomePage() {
        BackGroundVO vo = backgroundService.getHomePage();
        return R.ok(vo, 200, "ok");
    }

    /**
     * 首页退套餐购买趋势
     */
    @GetMapping("/trend")
    public R getTrend(TrendDTO dto) {
        BackGroundVO vo = backgroundService.getTrend(dto);
        return R.ok(vo);
    }

}
